class QueryPage<T> {
  int page = 1;
  int pageSize = 15;
  int _total = 0;
  int _totalPage = 0;

  List<T> data = [];

  QueryPage({int page = 1, int pageSize = 15});
  int get total => _total;
  int get totalPage => _totalPage;
  bool get hasNext => page < _totalPage;
  bool get hasPrev => page > 1;

  QueryPage<T> next() => this..page += (hasNext ? 1 : 0);
  QueryPage<T> prev() => this..page -= (hasPrev ? 1 : 0);

  set total (int total) {
    _total = total;
    _totalPage = (_total / pageSize).ceil();
  }
}